package block;

/**
 * Created with IntelliJ IDEA.
 * ClassName: Base
 * Package: block
 * Description:
 * User: fzykd
 *
 * @Author: LQH
 * Date: 2023-11-23
 * Time: 20:27
 */

public class Base {

    public static void main(String[] args) {
        AA a = new AA("张三", 19);
        System.out.println(a);
    }

}

class BB {
    private String name;
    private int age;

    public BB(String name, int age) {
        this.name = name;
        this.age = age;
    }

    @Override
    public String toString() {
        return "BB{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}

class AA extends BB {

    //子类可以获取到父类声明的所有的属性和方法
    //但是封装性的限制 子类不能直接调用父类的属性和方法

    public AA(String name, int age) {
        super(name, age);
    }

}